﻿<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true"
    CodeFile="SalesPersons.aspx.cs" Inherits="SalesPersons" Title="Ghasam | Sales Persons" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div>
        <div class="title">
            فروشندگان
        </div>
        <div>
            <hr />
        </div>
        <div>
            <asp:GridView ID="gvSalesPersons" runat="server" AllowPaging="True" PageSize="12"
                AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" OnRowDeleting="gvSalesPersons_RowDeleting"
                OnSelectedIndexChanging="gvSalesPersons_SelectedIndexChanging" OnSorting = "gvSalesPersons_Sorting">
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="کد" InsertVisible="False" ReadOnly="True" SortExpression = "Id" />
                    <asp:BoundField DataField="Title" HeaderText="نام" SortExpression = "Title"/>
                    <asp:BoundField DataField="Phone" HeaderText="تلفن" SortExpression = "Phone"/>
                    <asp:TemplateField HeaderText="تراز">
                        <ItemTemplate>
                            <%# Mani.Common.UIHelper.FormatString(Eval("Balance")) %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="تاریخ ایجاد" SortExpression = "CreateDate">
                        <ItemTemplate>
                            <%# Mani.Common.MyPersianDate.DateTimeToPersian(Eval("CreateDate")) %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="آخرین تغییر" SortExpression = "ModifyStamp">
                        <ItemTemplate>
                            <%# Mani.Common.MyPersianDate.DateTimeToPersian(Eval("ModifyStamp")) %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="EditSalesPerson" runat="server" CausesValidation="False" CommandName="Select">
                                <img src="App_Themes/<%=Page.Theme %>/images/edit.gif" alt="" style="border:0;" />
                            </asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="DeleteSalesPerson" runat="server" CausesValidation="False" CommandName="Delete">
                                <img src="App_Themes/<%=Page.Theme %>/images/delete.gif" alt="" style="border:0;" />
                            </asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
        
        <br />
        <br />
        
        <asp:Label ID="lblMessage" ForeColor="Red" runat="server" />
        
        <br />
        
        <div id="formcontainer">
            <div id="dvSalesPersonId" visible="false" runat="server">
                <asp:TextBox Id="txtSalesPersonId" runat="server" />
            </div>
            <div>
                <label>عنوان</label>
                <asp:TextBox ID="txtSalesPersonTitle" runat="server" />
                <asp:RequiredFieldValidator ID="rfvName" ValidationGroup="SalesPerson" runat="server"
                    ControlToValidate="txtSalesPersonTitle" ErrorMessage="*"></asp:RequiredFieldValidator>
            </div>
            <div>
                <label>شماره تلفن</label>
                <asp:TextBox ID="txtSalesPersonPhoneNumber" runat="server" />
                <asp:RequiredFieldValidator ID="rfvPhone" runat="server" ValidationGroup="SalesPerson"
                            ControlToValidate="txtSalesPersonPhoneNumber" ErrorMessage="*"></asp:RequiredFieldValidator>
            </div>
            <div>
                <label>آدرس</label>
                <asp:TextBox ID="txtSalesPersonAddress" runat="server" TextMode="MultiLine" Width="300"
                    Height="60" />
                <asp:RequiredFieldValidator ID="rfvAddress" runat="server" ValidationGroup="SalesPerson"
                    ControlToValidate="txtSalesPersonAddress" ErrorMessage="*"></asp:RequiredFieldValidator>
            </div>
            <div>
                <asp:Button ID="btnSaveSalesPerson" Text="ذخیره" runat="server" 
                    ValidationGroup="SalesPerson" onclick="btnSaveSalesPerson_Click" />
            </div>
        </div>
    </div>
</asp:Content>
